<?php

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class AssignedRolesTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //默认roles.all == 1拥有所有权限
        $datas = ['user_id'=>1,'role_id'=>1];
        $assignedRole = DB::table('assigned_roles')->where($datas)->first();
        if ($assignedRole){

            DB::table('assigned_roles')->where($datas)->update($datas);
        } else {

            DB::table('assigned_roles')->insert($datas);
        }
    }
}
